package cn.blogsx.datasource.druid;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

/**
 * JDBCDruid 工具类验证使用
 */
public class DruidDemo02 {
    public static void main(String[] args) {
        try {
            Connection connection = JDBCDruidUtils.getConnection();
            String sql = "insert into user values(null ,?,?,?)";
            PreparedStatement pres = connection.prepareStatement(sql);
            pres.setString(1,"张三");
            pres.setString(2,"123456");
            pres.setString(3,"男");
            int i = pres.executeUpdate();
            if(i>0){
                System.out.println("插入成功！");
            }

        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
